import { Link } from '@brillout/docpress'
import { UiFrameworkExtension, ProvidedBy, ConfigSpec } from '../../components'

<ConfigSpec
  default={<code>true</code>}
  providedBy={<ProvidedBy>the <code>ssr</code> setting</ProvidedBy>}
  isTypeOneLiner
>
`boolean {:ts}`
</ConfigSpec>

Setting to enable/disable SSR (Server-Side Rendering). You can disable SSR for all your pages or only for some pages.

> **What is SSR?** If you're unfamiliar with SSR, see:
> - <Link href="/what-is-SSR-and-SPA" />
> - <Link href="/SSR-vs-SPA" />
> - <Link href="/pre-rendering#ssg-vs-ssr" />


You can disable SSR for all your pages:

```ts
// /pages/+config.ts

import type { Config } from 'vike/types'

export default {
  // Applies to all pages
  ssr: false
} satisfies Config
```

Or disable SSR only for some pages:

```ts
// /pages/admin-panel/+config.ts

import type { Config } from 'vike/types'

export default {
  // Applies only to all pages living under /pages/admin-panel/
  ssr: false
} satisfies Config
```

```yaml
# Pages rendered and loaded only on the client-side
/pages/admin-panel/products/+Page.ts
/pages/admin-panel/users/+Page.ts

# Pages rendered and loaded on both client- and server-side. (Because they
# don't live under /pages/admin-panel/ thus the `ssr` setting doesn't apply.)
/pages/index/+Page.ts
/pages/about/+Page.ts
```

> For better config organization, you can use <Link href="/routing#groups">page groups</Link>.

Alternatively, instead of using the `+ssr` setting, you can use the <Link href="/clientOnly">`clientOnly()`</Link> helper to render and load some components only on the client-side, while rendering the rest of the page with SSR.

If your goal is to remove the need for a production server, then consider <Link href="/pre-rendering">pre-rendering your SSR pages</Link> instead of disabling SSR.


## Without `vike-{react,vue,solid}`

In case you don't use a <UiFrameworkExtension />, you can implement the `ssr` setting yourself.

Examples:
 - [`vike-react` source code](https://github.com/vikejs/vike-react/blob/main/packages/vike-react)
 - [`vike-vue` source code](https://github.com/vikejs/vike-vue/blob/main/packages/vike-vue)
 - [`vike-solid` source code](https://github.com/vikejs/vike-solid/blob/main/vike-solid)

> See also: <Link href="/render-modes" />


## See also

- <Link href="/pre-rendering" />
- <Link href="/stream" />
- <Link href="/SSR-vs-SPA" />
- <Link href="/what-is-SSR-and-SPA" />
